<!doctype html>
<html>
  <head>
    <title>polymer-ajax</title>
    <script src="../../../polymer/polymer.js"></script>
    <script src="../../../polymer/tools/test/htmltest.js"></script>
    <script src="../../node_modules/chai/chai.js"></script>
    <link rel="import" href="../../polymer-ajax/polymer-ajax.html">
  </head>
  <body>

    <polymer-ajax auto url="http://gdata.youtube.com/feeds/api/videos/" 
        params='{"alt":"json", "q":"chrome"}'
        handleAs="json">
    </polymer-ajax>
    
    <script>
      var assert = chai.assert;
      document.addEventListener('WebComponentsReady', function() {
        var ajax = document.querySelector('polymer-ajax');
        ajax.addEventListener("polymer-response", function(event) {
          assert.isTrue(event.detail.response.feed.entry.length > 0);
          done();
        });
      });
    </script>
  </body>
</html>
